/**
 * related to reducontent.ui
 * 
 * @Author : ln008
 * @Timestamp : 2017-04-19
 */
var nf=sm('do_Notification')
var dialog=sm("do_Dialog")
var imgBrow=sm('do_ImageBrowser')
var case_cancle=ui("case_cancle")
var log=require("util/log")
var page = sm("do_Page")
var btn_look=ui("btn_look")
var net = require("util/net")
var server = require('config/server')
var Controller = require("core/controller")
Controller({
	name : 'index',
	mapping : {
		"case_rpmoney.text":"payaPayNum",
		"case_redumoney.text":"payaDelaynum",
		"case_rptpname.text":"payaType",
		"case_rpfrname.text":"payaStyle",
		"case_cancle.tag":"idStatus",
		"btn_look.tag":"caseIconId",
		"case_revoktext.fontColor":"case_revok"
	},
	data : {
		casIcon:[],
	},
	ui : {
		root : '$',
		case_revoktext:"case_revoktext"
	},
	event : {
		'btn_look' : {
			"touch" : function() {
				this.lookIcon(btn_look.tag)
			}
		},
		'case_cancle': {
			"touch" : function() {
				if(case_cancle.tag==52||case_cancle.tag==66||case_cancle.tag==64){
					var data1 =btn_look.tag
					var self=this
					nf.confirm('是否撤回此条还款申请',function(index){
						if(index === 1){
							self.setCancell(btn_look.tag)
						}
					})	
				}				
			}
		}
	},
	methods : {	
		lookIcon : function(paya) {
			net.send({
				server : server.organization.getCaseIconId,
				data : {
					payaId : paya
				},
				success : function(csData) {
					log.info(5656561,this.data.casIcon)
					var list=csData.map(function(x) {
						return {
							source:x.url
						}
					})
					imgBrow.show(list)
					
				},
				error: function(data){
					nf.toast(data.reason)
				},
				scope : this
			})
		},
		setCancell : function(paya) {
			net.send({
				server : server.organization.CancellApply,
				data : {
					payaId : paya
				},
				success : function(casedata) {
					nf.toast("撤回成功")
					page.fire("casRefsh");
				},
				error: function(data){
					nf.toast(data.reason)
				},
				scope : this
			})
		}
	},
	loaded : function() {
	}
})